package pers.qtong.tank;

import java.io.IOException;
import java.util.Properties;

public class PropertiesMgr {
    private PropertiesMgr() {}

    private static final PropertiesMgr INSTANCE = new PropertiesMgr();

    public static PropertiesMgr getInstance() {
        return INSTANCE;
    }

    private static Properties props = new Properties();
    static {
        try {
            props.load(PropertiesMgr.class.getClassLoader().getResourceAsStream("config"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public Object get(String key) {
        return props.get(key);
    }

    public int getInt(String key) {
        return Integer.parseInt((String) props.get(key));
    }

    public String getString(String key) {
        return (String)props.get(key);
    }
}
